package Boundry;

import javax.swing.JPanel;

import Boundry.GenericTools.IPanelOperation;
import Boundry.GenericTools.InputPanel;
import Controllers.GenericToolsForController.BrowseScreen;

import javax.swing.JLabel;
import java.awt.Font;

import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.swing.JTextField;
import javax.swing.JButton;
import javax.swing.ImageIcon;
import javax.swing.JRadioButton;
import javax.swing.JRadioButtonMenuItem;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

public class TestingGUIScreen extends InputPanel implements ActionListener , IPanelOperation{
	private JTextField textFieldFile;
	private JButton btnBrowse;
	private BrowseScreen bs;
	private JLabel reqID;
	
	
	public static void main(String[] args)
	{
		JFrame frame = new JFrame();
		frame.getContentPane().add(new TestingGUIScreen());
		frame.setVisible(true);
		frame.setBounds(0, 0, 900, 450);
	}
	
	/**
	 * Create the panel.
	 */
	public TestingGUIScreen() {
		//Create a file chooser
		bs = new BrowseScreen();
		
		JLabel lblTesting = new JLabel("Testing Report");
		lblTesting.setFont(new Font("Tahoma", Font.PLAIN, 22));
		lblTesting.setBounds(255, 22, 181, 37);
		mainPanel.add(lblTesting);
		
		JLabel lblFile = new JLabel("File:");
		lblFile.setFont(new Font("Tahoma", Font.PLAIN, 16));
		lblFile.setBounds(159, 122, 71, 29);
		mainPanel.add(lblFile);
		
		textFieldFile = new JTextField();
		textFieldFile.setBounds(227, 124, 209, 29);
		mainPanel.add(textFieldFile);
		textFieldFile.setColumns(10);
		
		btnBrowse = new JButton("");
		btnBrowse.addActionListener(this);
		btnBrowse.setIcon(new ImageIcon(TestingGUIScreen.class.getResource("/GUI/Image/4_collections_collection.png")));
		btnBrowse.setBounds(462, 109, 105, 30);
		mainPanel.add(btnBrowse);
		
		JLabel label = new JLabel("");
		label.setIcon(new ImageIcon(TestingGUIScreen.class.getResource("/GUI/Image/5_content_paste.png")));
		label.setBounds(194, 22, 51, 37);
		mainPanel.add(label);
		
		JRadioButton rdbtnTestingPassed = new JRadioButton("Testing passed");
		rdbtnTestingPassed.setBounds(204, 205, 109, 23);
		mainPanel.add(rdbtnTestingPassed);
		
		JRadioButton rdbtnTestingFailed = new JRadioButton("Testing Failed");
		rdbtnTestingFailed.setBounds(353, 205, 109, 23);
		mainPanel.add(rdbtnTestingFailed);
		
		JLabel lblNewLabel = new JLabel("Request Id: ");
		lblNewLabel.setBounds(159, 97, 89, 14);
		mainPanel.add(lblNewLabel);
		
		reqID = new JLabel("");
		reqID.setBounds(293, 86, 46, 14);
		mainPanel.add(reqID);

	}

	@Override
	public void actionPerformed(ActionEvent e) {
		// TODO Auto-generated method stub
		//bs.getBrowseScreen();
		bs.ChooseFile();
		textFieldFile.setText( bs.getPath());
		
		
	}
	
	public BrowseScreen getBrowseScreen()
	{
		return this.bs;
	}

	public void setdata(String string) {
		reqID.setText(string);
	}

	@Override
	public String apHelpButton() {
		return "In this screen you need to choose pdf file of your summery and decide the action";
	}

	@Override
	public String setTitle() {
		return "Testing";
	}
}
